package com.boarsoft.flow.demo.make;

import java.util.HashMap;
import java.util.Map;

import com.boarsoft.flow.core.bean.ForkHandler;

public class MakeMoneyForkHandlerImpl implements ForkHandler {

	@SuppressWarnings("unchecked")
	@Override
	public Map<String, Object> fork(String key, Object data, Throwable throwable) {
		Map<String, Object> pm = (Map<String, Object>) data;
		String userId = (String) pm.get("userId");
		int work = (Integer) pm.get("work");
		Map<String, Object> rm = new HashMap<String, Object>();
		for (int i = 0; i < work; i++) {
			rm.put(String.valueOf(i), userId);
		}
		return rm;
	}
}
